//模拟封装jQuery $
function $key(getkeys) {
    return document.querySelector(getkeys);
}


// 提取日期相关函数
date();
function date() {
    var spa = document.querySelector(".dater");
    var timer = null;
    // 封装时间日期格式化
    function mydate() {
        var date = new Date();
        // 时间日期格式化 yyyy-mm-dd hh:mm:ss
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var data = date.getDate();
        var hours = date.getHours();
        var minutes = date.getMinutes();
        var seconds = date.getSeconds();
        // 补 0
        month = (month < 10) ? "0" + month : month;
        data = (data < 10) ? "0" + data : data;
        hours = (hours < 10) ? "0" + hours : hours;
        minutes = (minutes < 10) ? "0" + minutes : minutes;
        seconds = (seconds < 10) ? "0" + seconds : seconds;
        var res = `${year}年${month}月${data}日 ${hours}:${minutes}:${seconds}`;
        return res;
    }
    function automove() {
        spa.innerHTML = mydate();
    }
    // 自动走
    setInterval(automove, 1000);
}


var box=document.getElementsByClassName("tpop")[0];
box.innerHTML=`
    <div>
        <div class="gender">姓名：</div>
        <input type="text" class="kyama names">
    </div>
    <div>
        <div class="gender acco">性别：</div>
        <input type="text" class="kyama sexes">
    </div>
    <div>
        <div class="gender">电话：</div>
        <input type="text" class="kyama phone">
    </div>
    <div>
        <div class="gender acco">账号：</div>
        <input type="text" class="kyama acount">
    </div>
    <div>
        <div class="gender">密码：</div>
        <input type="text" class="kyama passwor">
    </div>
`
var boxee=document.getElementsByClassName("bpop")[0];
boxee.innerHTML=`
    <button class="amend">修改</button>
`
 

//调取本地登录数据
var names=document.getElementsByClassName("names")[0];
names.value=localStorage.getItem("username");
var sexes=document.getElementsByClassName("sexes")[0];
sexes.value=localStorage.getItem("userSex");
var phone=document.getElementsByClassName("phone")[0];
phone.value=localStorage.getItem("userPhone");
var acount=document.getElementsByClassName("acount")[0];
acount.value=localStorage.getItem("userAccount");
var passwor=document.getElementsByClassName("passwor")[0];
passwor.value=localStorage.getItem("userPassword");


// 添加点击事件
//日志系统
var journal = document.getElementsByClassName("journal")[0];
journal.onclick = function () {
    location.href = "./diary.html";
}
//首页
var classs = document.getElementsByClassName("classs");
classs[0].onclick = function () {
    location.href = "./header.html";
}
//日常
var routine = document.getElementsByClassName("routine")[0];
routine.onclick = function () {
    location.href = "./vacate.html";
}
//系统设置
var system = document.getElementsByClassName("system")[0];
system.onclick = function () {
    location.href = "./setting.html";
}
//项目管理
var project = document.getElementsByClassName("project")[0];
project.onclick = function () {
    location.href = "./projectmanagement.html";
}
//请假记录
var excused = document.querySelector(".excused");
excused.addEventListener('click', function () {
    location.href = "./vacate.html";
});
//考勤记录
var presence = document.querySelector(".presence");
presence.addEventListener('click', function () {
    location.href = "./clock.html";
});
